<div ng-include="sys_html('common/_header','','','jy_weishop')"></div>
<style>
    .yen{border:none;height:0.75rem;width:0.75rem;display: inline-block;background: #ff4753;color:#fff;font-size:0.4rem;line-height: 0.8rem;text-align: center;
        font-style: normal;border-radius: 0.75rem;-webkit-border-radius: 0.75rem;}
    .order-create-page .fui-list.goods-item .fui-list-inner{
        height: 3.5rem;
        align-self: center;
    }
    .order-create-page .fui-list.goods-item .fui-list-angle{
        height: 3.5rem;
        align-self: center;
    }
    .order-create-page .fui-list-inner .subtitle{
        display: block;
    }
    .fui-header a.back2:before {
        content: " ";
        display: inline-block;
        -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        transform: rotate(45deg);
        height: 0.5rem;
        width: 0.5rem;
        border-width: 0 0 2px 2px;
        border-color: #666;
        border-style: solid;
        position: relative;
        top:0;
    }
.fui-btn-c {
    height: auto;
    margin: 0;
    padding: 0.4rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
	justify-content:center;
    align-items: center;
    position: relative;
}

.fui-btn-c .icon {
	font-size:1rem;
	padding-right:0.3rem;
	text-align:right;
}

.fui-btn-c .info {
	text-align:left;
    padding-right: 0.2rem;
    font-size: 0.75rem;
}

.fui-btn-c .info p {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.jylabel-red-0.active::after{content:" ";width:23px;height:24px;background:url(../core/resource/images/gou-red.png) no-repeat;position:absolute;float:right;right:-1px;bottom:-1px;text-align:center;}
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category ul{margin:0; padding:0; width:100%;}
.parent-category ul li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category ul li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category ul li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.parent-category ul li.active a{color:#09ba07;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category ul li{text-align:left; height: 32px; line-height: 32px; padding-left: 15px}
.children-category ul li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: .65rem; color: #ff2d4b}
.children-category ul li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category ul li a span{font-size: .6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:.6rem;}
.fui-navbar .cartbtn {padding-right:0.3rem;background:#fff;opacity:1}
.fui-navbar .buybtn  {padding-left:0.3rem;background:#fff}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:2rem;color:#fff;width:100%;font-weight:400;font-size:0.7rem;margin:0.2rem 0;padding:0 0.2rem}
.fee-tagup {background:{{main.syscolor || 'red'}};color:#fff;width:auto;font-weight:400;font-size:0.55rem}
.fee-tag-nav {background:{{main.syscolor || 'red'}}; opacity: 0.58;}
.fee-tagup-nav {background:{{main.syscolor || 'red'}};}
.fee-disabled-nav {background:#bbb;color:#fff;}	
.coutag {padding:0.1rem 0.2rem;background:#ffedef;color:#db2e2a;font-size:0.55rem;border-radius: 0.2rem;}
</style>
<style>
.ui-step {
    padding:0.3rem 0;
    zoom: 1;
    margin: 0 0.3rem;
}
.ui-step:after {
    content: "";
    display: table;
    clear: both
}
.ui-step li {
    float: left;
    position: relative;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
	list-style:none;
    text-align: center
}
.ui-step li::before, .ui-step li::after {
    position: absolute;
    left: 0;
    top: 46px;
    display: block;
    content: ' ';
    width: 50%;
    height: 4px;
    background: #f2f3f7;
    z-index: 1
}
.ui-step li::after {
    left: 50%
}
.ui-step li:first-child::before {
    width: 0
}
.ui-step li:last-child::after {
    width: 0
}
.ui-step .ui-step-title {
    color: #333;
    font-size: 0.5rem;
    line-height: 18px
}
.ui-step .ui-step-number {
    position: relative;
    display: inline-block;
    width: 37px;
    height: 37px;
    margin: 10px 0;
    line-height: 37px;
    background: #f2f3f7;
    color: #cac9c9;
    border-radius: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    z-index: 2;
}
.ui-step li.ui-step-done .ui-step-number {
    color: #fff;
}
.ui-step .ui-step-meta {
    color: #ccc;
	font-size:0.5rem
}
.ui-step li.ui-step-done::before,
.ui-step li.ui-step-done::after,
.ui-step li.ui-step-done .ui-step-number {
    background: #54c952
}
.ui-step-2 li {
    width: 50%
}
.ui-step-3 li {
    width: 33.33333%
}
.ui-step-4 li {
    width: 24.9999%
}
.ui-step-5 li {
    width: 20%
}
.ui-step-8 li {
    width: 12.499%;
}
</style>
<div class='fui-page order-create-page'>
	<div class="fui-header">
        <div class="fui-header-left">
            <a class="back" ng-click='goback()'></a>
        </div>
        <div class="title">配置单</div>
    </div>
    <div class='fui-content' style="padding-bottom:4.8rem">
	<div ng-if="pagedata.order.status>=1 && pagedata.order.api_data.buytype!=1" class="title" style="padding:0">
				<div class="fui-cell-title bold">配置流程</div>
				<div class="step-region">
				<ul class="ui-step ui-step-3">
					<li ng-class="{'ui-step-done':pagedata.order.send_status>=1}">
						<div class="ui-step-title" >选择配置类型</div>
						<div class="ui-step-number" >1</div>
						<div class="ui-step-meta" ng-if="pagedata.order.api_data.send1time">
						{{date(pagedata.order.api_data.send1time)}}<br/>
						</div>
					</li>
					<li ng-class="{'ui-step-done':pagedata.order.send_status>=2}">
					<div class="ui-step-title">选择户型</div>
					<div class="ui-step-number">2</div>
					<div class="ui-step-meta" ng-if="pagedata.order.api_data.send2time">{{date(pagedata.order.send2time)}}</div>
					</li>
					<li ng-class="{'ui-step-done':pagedata.order.send_status>=3}">
					<div class="ui-step-title">产生配置单</div>
					<div class="ui-step-number" >3</div>
					<div ng-if="pagedata.order.api_data.send3time" class="ui-step-meta" >{{date(pagedata.order.send3time)}}</div>
					</li>
				</ul>
				</div>
	</div>
	<div ng-show="(pagedata.post.sendtype==2 || pagedata.post.sendtype==3) && pagedata.shopset.is_noordermobile!=1" class="fui-cell-group" id="memberInfo">
                <div class="fui-cell">
                    <div class="fui-cell-label">联系人</div>
                    <div class="fui-cell-info c000"><input type="text" placeholder="请输入联系人" class="fui-input" ng-model="pagedata.post.realname"/></div>
                </div>
                <div class="fui-cell">
                    <div class="fui-cell-label">联系电话</div>
                    <div class="fui-cell-info c000"><input type="tel" placeholder="请输入联系电话"  class="fui-input" ng-model="pagedata.post.mobile"/></div>
                </div>
    </div>
<div class="fui-list-group"  style="margin-top:0">
    <div ng-repeat="g in pagedata.order.list" class="fui-list goods-item align-start">
        <div class="fui-list-media">
            <a href="javascript:;" ng-click="access_json('/goods.detail//id='+g.id)">
                <img class="round" ng-src="{{tomedia(g.image)}}">
            </a>
        </div>
        <div class="fui-list-inner" style="height:auto">
            <div href="javascript:;" ng-click="access_json('/goods.detail//id='+g.id)">
                <div class="subtitle">{{g.title}}</div>
                <div class="text" style="font-size:0.65rem">
				<!--<span class="">{{g.api_data.year||0}}年</span> | 
				<span class="">{{g.api_data.gongli||0}}万公里</span>-->
				</div>
            </div>
			<div class='price'>
				<span class="bigprice text-danger">￥<span ng-if="!g.active.price" class='marketprice'>{{g.price}}</span><span ng-if="g.active.price" class='marketprice'>{{g.active.price}}</span> <span ng-if="g.active.title" class='red' style="font-size:0.65rem;font-weight:400"> {{g.active.title}}</span> <span ng-if="g.buyxiu_de_price>0" style="font-size:0.65rem;font-weight:400" class='red'>买家秀 -￥{{g.buyxiu_de_price}}</span></span>
				<span class="num bold">x {{g.total}}</span>
			</div>
        </div>
    </div>
    <script type="text/javascript">
        $(function(){
            $(".package-goods-img").height($(".package-goods-img").width());
        })
    </script>
 
</div>
<div class="fui-cell-group">
	<div class="fui-cell" onclick="$('#showremark').modal();">
        <div class="fui-cell-label" style="width:100px">买家留言</div>
        <div class="fui-cell-text gray r"><span>选填</span>({{pagedata.post.remark || '***'}})</div>
		<div class="fui-cell-remark" ></div>
    </div>
</div>
<div ng-include="sys_html('common/_diyform',true)"></div>
<div class="fui-cell-group">
	<div class="fui-cell">
			<div class="fui-cell-label" style="width:100px">空调金额</div>
			<div class="fui-cell-info"></div>
			<div class="fui-cell-remark noremark bold">
			<span class='dispatchprice'>
			￥{{price(pagedata.order.total_price) || '0.00'}}
			</span>
			</div>
	</div>
	<div class="fui-cell">
			<div class="fui-cell-label" style="width:100px">空调购车定金</div>
			<div class="fui-cell-info"></div>
			<div class="fui-cell-remark noremark bold">
			<span class='dispatchprice'>
			￥{{price(pagedata.post.endprice) || '0.00'}}
			</span>
			</div>
	</div>
	<div ng-if="pagedata.order.credit" class="fui-cell">
		<div class="fui-cell-label">送积分</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='packageprice'><span class="red">{{pagedata.order.credit}}</span>个</span>
		</div>
	</div>
	<div ng-repeat="cv in pagedata.order.credit3" class="fui-cell">
		<div class="fui-cell-label">送{{cv.title}}</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='packageprice'><span class="red">{{cv.credit}}</span>个</span>
		</div>
	</div>
	<div ng-if="pagedata.order.fang_credit2>0" class="fui-cell">
		<div class="fui-cell-label">返现</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='packageprice'>￥{{pagedata.order.fang_credit2}}</span>
		</div>
	</div>
</div>
</div>
<div id="showremark"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">留言</div>
				</div>
				<div class="fui-cell">
					<div class="fui-cell-info c000">
						<textarea rows="5" placeholder="50字以内（选填）" ng-model="pagedata.post.remark"></textarea>
					</div>
				</div>
			</div>
			<div class="fui-navbar" style="padding:0.35rem 1rem">
				<a href="javascript:;"  aria-hidden="true" data-dismiss="modal" class="btn btn-danger btn-banf" style="margin:0;width:100%">确定</a>
			</div>
		</div>
	</div>
</div>
<div class="fui-navbar-tip" ng-if="pagedata.buyxieyi.isopen==1" style="height:1.8rem">
<div class="fui-cellone sm" style="padding:0">
	<div class="fui-cellone-info" style='line-height:1.4;font-size:0.7rem'>
		<span class="text"><input type="checkbox" ng-checked="pagedata.post.checked==true" ng-model="pagedata.post.checked" name="checkbox" class="fui-radio fui-radio-danger cartmode check-item"/></span>
		<span class="text" ng-click="pagedata.show_xieyi=true;">请先阅读【{{pagedata.buyxieyi.title || '会员购车协议'}}】</span>
	</div>
</div>
</div>
<div class="fui-navbar-tip" ng-if="pagedata.shopset.open_tips==1 && pagedata.buyxieyi.isopen!=1"><i class="icon icon-information" style="font-size:0.6rem;color:red"></i> {{pagedata.shopset.tips}}</div>
<div class="fui-navbar order-create-checkout">
    <a href="javascript:;" class="nav-item total" style="text-align:left;padding-left:0.5rem">
        <span class="text-danger bigprice">&yen; 
			<span class="totalprice" style="font-size:1.2rem">{{price(pagedata.post.endprice) || '0.00'}}</span>
		</span>
		<div class="syscolor" style="font-size:0.6rem;margin-right:0.15rem;margin-top:-0.35rem">空调购车定金</div>
    </a>
	<a href="javascript:;" ng-if="pagedata.peerpay && !pagedata.order_id && ((pagedata.order.no_out_price==0 && pagedata.order.outarea!=1) || pagedata.post.sendtype!=1)" class="nav-item btn buybtn" ng-click="pagedata.post.peerpay=true;post(pagedata.post,'jy_kongtiaoshop/order.create/post/')" >	
		<div class="fee-tag-nav">
			找人代付
		</div>
	</a>
    <a href="javascript:;" class="nav-item btn buybtn" ng-if="!pagedata.order_id && ((pagedata.order.no_out_price==0 && pagedata.order.outarea!=1) || pagedata.post.sendtype!=1)" ng-click="pagedata.pay_submit(pagedata.post,'jy_kongtiaoshop/order.create/post/','/order.list//fromcreate=1');">
		<div class="fee-tagup-nav">
			立即下单
		</div>
	</a>
	<a href="javascript:;" class="nav-item btn buybtn" ng-if="pagedata.order_id" ng-click="access_json('/order.detail//id='+pagedata.order_id+'&fromcreate=1')" >
		<div class="fee-tag-nav">
			查看订单
		</div>
	</a>
</div>
<div id="showstoreitem"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">{{pagedata.storeitem.title}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">地址：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.pcd.province}} {{pagedata.storeitem.pcd.city}} {{pagedata.storeitem.pcd.district}} {{pagedata.storeitem.pcd.street}} {{pagedata.storeitem.address}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">联系人：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.realname}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">联系电话：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.mobile}}</div>
				</div>
			</div>
			<div class="fui-navbar" style="padding:0.35rem 1rem">
				<a href="javascript:;"  aria-hidden="true" data-dismiss="modal" class="btn btn-danger btn-banf" style="margin:0;width:100%">关闭</a>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('shop/_selectareas')"></div>
<!-- 放弃付款-->
<div ng-if="pagedata.checkcancel" class="popup">
			<div class="popup-body">
			<div class="popup-center" style="border-radius:0.2rem;">
				<div class="fui-page-title" style="margin-top:1rem">确定要取消订单吗？</div>
				<div class="fui-page-subtitle" style="margin-top:0.1rem">喜欢的空调可能随时会被抢空哦</div>
				<div class="modal-footer" style="margin-top:2rem">
					<a ng-click="pagedata.checkcancel=false" class="mod-fail">取消</a>
					<a href="javascript:" ng-click="post({},'cancel','id='+pagedata.order.id);pagedata.checkcancel=false" class="mod-success" style="background:red">确定</a>
				</div>
			</div>
			</div>
</div>
<div ng-if="pagedata.showtostoretime" class="popup">
		<style>
		.jyui_cell_col .red {
			background: red;
		}
		</style>
			<div class="popup-body">
			<div class="popup-bottom" style="border-radius:0.2rem;">
				<i class="closed icon icon-cuowu" ng-click="pagedata.showtostoretime=false"></i>
				<div class="fui-page-title" style="margin-top:1rem">选择要上门签约的时间！</div>
				<div class="fui-page-subtitle" style="margin-top:0.1rem">请在指定时间上门签约哦，不然可能门店没营业哦！</div>
				<div class="weui_cells_radio3">
					<div class="fui-icon-group noborder col-5">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_timedata" style="margin-top:0">
						<label class="jyui_cell_col">
							<div ng-if="item.iswork==1" ng-class="{'coltime colchecked':1,'red':pagedata.post.tostoretime==item.riqi}" ng-click="pagedata.post.tostoretime=item.riqi;pagedata.post.tostoreday=item.day">
								<div class="timetitle"><span>{{item.riqi}}</span></div>
								<div class="timetitle"><span>{{item.xinq}}</span></div>
							</div>
							<div ng-if="item.iswork!=1" class="coltime">
								<div class="timetitle"><span>{{item.riqi}}</span></div>
								<div class="timetitle"><span>{{item.xinq}}</span></div>
							</div>
						</label>
					</div>
					</div>
				</div>
				<div class="fui-cellone noborder">
					<div class="fui-cellone-label bold" style="width:auto;">上门时间段：</div>
					<div class="fui-cellone-info r">
					<select class="weui_select" name="cateid2" ng-model="pagedata.post.tostorehour">
                        <option ng-repeat="hour in pagedata.work_hours" ng-if="pagedata.nowtime<hour.timestamp || pagedata.nowmonthday!=pagedata.post.tostoretime" value="{{hour.timev}}">{{hour.timev}}</option>
					</select>
					</div>
				</div>
			</div>
			</div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" style="font-size:1.2rem;top:105%;" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">{{pagedata.buyxieyi.title||'会员购车协议'}} / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.buyxieyi.content)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.checked=true" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
			</div>
		</div>
	</div>
</div>
<script language='javascript'>
scope.pagedata.yuejie_select=function(yuejie_select){
	scope.pagedata.post.yuejie_select=yuejie_select;
	scope.pagedata.pay_submit(scope.pagedata.post,'jy_kongtiaoshop/order.create/post/','/order.list//fromcreate=1');
}
scope.pagedata.pay_submit=function(post,post_url,complete_url){
	var str = /^[1][3,4,5,6,7,8,9][0-9]{9}$///手机
    var strname =  /^[\u4e00-\u9fa5]+(·[\u4e00-\u9fa5]+)*$/ //中文
    var stremail = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
    var filedata = scope.pagedata.post.diyfields?scope.pagedata.post.diyfields:[]
	for (var i=0;i<filedata.length;i++){
		if((filedata[i].ismust ==1 || filedata[i].ismust ==1) && !filedata[i].data){
			scope.message(filedata[i].title +'-不能为空！','error');
			return false
		}
		if(filedata[i].type ==8 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(str.test(filedata[i].data))){
			  scope.message("请输入正确的手机号码！",'error')
			   return false;
			}
		}
		if(filedata[i].type ==9 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(stremail.test(filedata[i].data))){
			  scope.message("请输入正确的邮箱！",'error')
			   return false;
			}
		}
	}
	if(scope.pagedata.mid==0 && post.sendtype==1){
		if(!(str.test(post.address.mobile))){
				  scope.message("请输入正确的手机号码！",'error')
				  return false;
		}
		if(!post.address.name){
				  scope.message("请输入收货人！",'error')
				  return false;
		}
		if(!post.address.address){
				  scope.message("请输入正确的收货地址！",'error')
				  return false;
		}
	}
	//console.log(post);
	scope.post_json(post_url,post,function(result){
		console.log(result);
		var success_url=result.success_url?result.success_url:complete_url
		if(result.order_id){
			scope.pagedata.order_id=result.order_id;
			var error_url=result.error_url?result.error_url:complete_url
			scope.$evalAsync();
			scope.tool.pay(result.pay_id,function(res){
					if(res.type=='success'){
						var msg=scope.paydata.type=='hdfk'?'下单成功，请保持电话畅通!':'支付成功!';
						scope.message(msg,'',success_url);
					}else{
						scope.message('支付失败！','',error_url);
					}
			},'','',success_url,error_url);
		}else{
			scope.message('下单成功，请保持电话畅通!','',success_url);
		}
	});
}
scope.pagedata.setting=scope.pagedata.setting?scope.pagedata.setting:{}
scope.pagedata.showstoreitem=function(){
	$('#showstoreitem').modal();
}
scope.pagedata.gotoshowstoretime=function(){
	scope.get('jy_weishop/store.index/get_work_time/store_id='+scope.pagedata.post.storeid,function(res){
		scope.pagedata.work_timedata=res.days;
		scope.pagedata.work_hours=res.hours;
		scope.pagedata.showtostoretime=true;
		res.hours[0]=res.hours[0]?res.hours[0]:{};
		scope.pagedata.post.tostorehour=res.hours[0].timev
		scope.$evalAsync();
	});
}
scope.pagedata.selectareas=function(item){
	console.log('选择门店'+item.id);
	scope.pagedata.post.storeid = item.id;
	scope.pagedata.post.is_work_time = item.is_work_time;
	scope.pagedata.selectarea=item;
}
scope.pagedata.checkcoupon=function(type){
	if(type){
		scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price - scope.pagedata.post.coupon_de_price
		if(scope.pagedata.post.no_dispatch_price<0){
			scope.pagedata.post.no_dispatch_price=0
		}
		scope.pagedata.post.endprice = scope.pagedata.order.endprice - scope.pagedata.post.coupon_de_price
		if(scope.pagedata.post.endprice<0){
			scope.pagedata.post.endprice=0
		}
	}else{
		scope.pagedata.post.couponid=0;
		if(scope.pagedata.post.backtype!=1){
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price
			scope.pagedata.post.endprice = scope.pagedata.order.endprice
		}else{
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price;
			scope.pagedata.post.endprice = scope.pagedata.order.endprice		
		}
	}
	scope.pagedata.post.credit3=parseFloat(scope.pagedata.post.endprice*scope.pagedata.credit3_rate);
	scope.pagedata.post.no_dispatch_credit3=parseFloat(scope.pagedata.post.no_dispatch_price*scope.pagedata.credit3_rate);
	scope.pagedata.showcoupon=false;
	scope.$evalAsync();
}
scope.pagedata.selecttime=function(){
	$('#selecttime').modal();
	var store_id=scope.pagedata.post.storeid
	scope.get('jy_weishop/store.index/out_time/store_id='+store_id+'&out_pay='+scope.pagedata.order.dispatchprice,function(res){
		scope.pagedata.out_time=res.out_time;
		scope.pagedata.predict_time=res.predict_time;
		scope.pagedata.post.out_time=scope.pagedata.post.out_time?scope.pagedata.post.out_time:res.predict_time
		scope.pagedata.timestamp=res.timestamp;
		scope.$evalAsync();
	});
}
$("input,select").blur(function(){
        setTimeout(function() {
                var scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
                window.scrollTo(0, Math.max(scrollHeight - 1, 0));
            }, 100);
})
scope.pagedata.no_deduct_credit=function(){
	scope.pagedata.post.no_deduct_credit=scope.pagedata.post.no_deduct_credit==1?0:1;
	if(scope.pagedata.post.no_deduct_credit==1){
		scope.pagedata.post.no_dispatch_price = scope.pagedata.post.no_dispatch_price+parseFloat(scope.pagedata.order.deduct_credit)
		scope.pagedata.post.endprice = scope.pagedata.post.endprice+parseFloat(scope.pagedata.order.deduct_credit)
	}else{
		scope.pagedata.post.no_dispatch_price = scope.pagedata.post.no_dispatch_price-parseFloat(scope.pagedata.order.deduct_credit)
		scope.pagedata.post.endprice = scope.pagedata.post.endprice-parseFloat(scope.pagedata.order.deduct_credit)
	}
	scope.pagedata.post.credit3=parseFloat(scope.pagedata.post.endprice*scope.pagedata.credit3_rate);
	scope.pagedata.post.no_dispatch_credit3=parseFloat(scope.pagedata.post.no_dispatch_price*scope.pagedata.credit3_rate);
	scope.$evalAsync();
}
scope.pagedata.no_di_cardfee=function(){
	scope.pagedata.post.no_di_cardfee=scope.pagedata.post.no_di_cardfee==1?0:1;
	if(scope.pagedata.post.no_di_cardfee==1){
		scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dicard_dispatch_endprice
		scope.pagedata.post.endprice = scope.pagedata.order.no_dicard_endprice
	}else{
		scope.pagedata.post.no_dispatch_price -= scope.pagedata.order.no_dispatch_cardfee
		scope.pagedata.post.endprice -= scope.pagedata.order.di_cardfee
		if(scope.pagedata.post.endprice<0){
			scope.pagedata.post.endprice=0
		}
		if(scope.pagedata.post.no_dispatch_price<0){
			scope.pagedata.post.no_dispatch_price=0
		}
	}
	scope.pagedata.post.credit3=parseFloat(scope.pagedata.post.endprice*scope.pagedata.credit3_rate);
	scope.pagedata.post.no_dispatch_credit3=parseFloat(scope.pagedata.post.no_dispatch_price*scope.pagedata.credit3_rate);
	scope.$evalAsync();
}
// 百度地图API功能
scope.pagedata.getareas=function(lat_lng){
	var id=scope.pagedata.order.list[0]?scope.pagedata.order.list[0].id:'';
	scope.post_json('jy_kongtiaoshop/get_data/getareas/',{'lat_lng':lat_lng,'id':id,'city':scope.pagedata.params.city},function(res){
			scope.pagedata.areas =res.areas
			scope.pagedata.areas_count =res.areas_count
			scope.$evalAsync();
	});
}
if(!scope.pagedata.lat_lng && !scope.main.lat_lng){
	window.scope.location(function(res){
		scope.main.lat_lng=res.lat_lng;
		scope.main.pcd=res.addressComponents;
		scope.pagedata.getareas(res.lat_lng);
	},scope.pagedata.setting.no_location);
}else{
	scope.pagedata.getareas(scope.main.lat_lng);
}
scope.pagedata.selectareas=function(item){
	console.log('选择门店'+item.id);
	scope.pagedata.post.area_mid = item.mid;
	scope.pagedata.selectarea=item;
}
</script>
<div ng-include="sys_html('common/_footer')"></div>
</div>